clear all
set more off

cd "\workfiles"

use step001_QJE_2, clear
keep if it12_all>=-3


****=====================================================================
****			distribution of beliefs by horizon
****=====================================================================


sum infl if time==219
local inf0=r(mean)	
twoway (kdensity it6  [aw=peso] if time==219 & it6_all>=-3 & it6_all<=7, bw(0.25) lpattern(dash) lcolor(red) ) ///
	   (kdensity it6n  [aw=peso] if time==219 & it6_all>=-3 & it6_all<=7, bw(0.25) lpattern(solid) lcolor(black) lwidth(thick)) ///
	, legend(off) ///
	xtitle("expected inflation") ///
	ytitle("density") ///
	title("Panel A: 6-month ahead") ///
	graphregion(color(white)) bgcolor(white)  ///
	xlabel(-3(1)7) ///
	ylabel(0(0.2)1) ///
	name(fig215_6m, replace) ///
	xline(`inf0', lcolor(blue)) 
	
	
sum infl if time==219
local inf0=r(mean)	
twoway (kdensity it12  [aw=peso] if time==219 & it12_all>=-3 & it12_all<=7, bw(0.25) lpattern(dash) lcolor(red) ) ///
	   (kdensity it12n  [aw=peso] if time==219 & it12_all>=-3 & it12_all<=7, bw(0.25) lpattern(solid) lcolor(black) lwidth(thick)) ///
	, legend(off) ///
	xtitle("expected inflation, 1-year ahead") ///
	ytitle("density") ///
	title("Panel B: 1-year ahead") ///
	graphregion(color(white)) bgcolor(white)  ///
	xlabel(-3(1)7) ///
	ylabel(0(0.2)1) ///
	name(fig215_12m, replace) ///
	xline(`inf0', lcolor(blue)) 
	
	
	
sum infl if time==219
local inf0=r(mean)	
twoway (kdensity it24  [aw=peso] if time==219 & it24_all>=-3 & it24_all<=7, bw(0.25) lpattern(dash) lcolor(red) ) ///
	   (kdensity it24n  [aw=peso] if time==219 & it24_all>=-3 & it24_all<=7, bw(0.25) lpattern(solid) lcolor(black) lwidth(thick)) ///
	, legend(label(1 "treated") label(2 "control") rows(2) ring(0) position(1)) ///
	xtitle("expected inflation, 1-year ahead") ///
	ytitle("density") ///
	title("Panel C: 2-year ahead") ///
	graphregion(color(white)) bgcolor(white)  ///
	xlabel(-3(1)7) ///
	ylabel(0(0.2)1) ///
	name(fig215_24m, replace) ///
	xline(`inf0', lcolor(blue)) ///
	text(0.87 1.3  "treatment", color(blue))	

	
sum infl if time==219
local inf0=r(mean)	
twoway (kdensity it48  [aw=peso] if time==219 & it48_all>=-3 & it48_all<=7, bw(0.25) lpattern(dash) lcolor(red) ) ///
	   (kdensity it48n  [aw=peso] if time==219 & it48_all>=-3 & it48_all<=7, bw(0.25) lpattern(solid) lcolor(black) lwidth(thick)) ///
	, legend(off) ///
	xtitle("expected inflation, 1-year ahead") ///
	ytitle("density") ///
	title("Panel D: 4-year ahead") ///
	graphregion(color(white)) bgcolor(white)  ///
	xlabel(-3(1)7) ///
	ylabel(0(0.2)1) ///
	name(fig215_48m, replace) ///
	xline(`inf0', lcolor(blue)) 	

graph combine 	fig215_6m fig215_12m fig215_24m fig215_48m, ///
	rows(2) imargin(tiny) ///
	graphregion(color(white)) ///
	name(comb3, replace)
	
